<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>锤子科技商城注册</title>
</head>

<body>
<?php
include "../mysql/mysql.php";
$aa = new mysql;
$aa->link("");
include "../myfunction.php";
$bb= new myfunction;

//获取注册表单的数据
$username = $bb->test_input( $_REQUEST['username'] );
$password = $bb->test_input( $_REQUEST['pw01'] );
$password = $bb->jiami( $password);

$s01 = $bb->test_input( $_REQUEST['s01'] );
$ss01 = $bb->test_input( $_REQUEST['ss01'] );
$ss01 = $bb->jiami( $ss01);

$s02 = $bb->test_input( $_REQUEST['s02'] ); 
$ss02 = $bb->test_input( $_REQUEST['ss02'] );
$ss02 = $bb->jiami( $ss02);


if (@$_FILES["picture"]["error"] == 0) 
    { 
     $filename = @$_FILES["picture"]["name"];
     $filetmp = @$_FILES['picture']['tmp_name'];

     $pic = $bb->uploaduserpic($filename, $filetmp);

//var_dump($pic);

//var_dump($ss01);

$sql = "INSERT INTO user_info (user_name, user_pw, img, qpass1, anspass1, qpass2, anspass2) 
                       VALUES ('$username', '$password', '$pic', '$s01', '$ss01', '$s02', '$ss02' )";
$result= $aa->excu($sql);
	}
	else{
		$sql = "INSERT INTO user_info (user_name, user_pw, img, qpass1, anspass1, qpass2, anspass2) 
                       VALUES ('$username', '$password', '', '$s01', '$ss01', '$s02', '$ss02' )";
       $result= $aa->excu($sql);
		}

if ($result == TRUE) {
echo "恭喜您注册成功，3s后跳转到登陆页面";
echo "<meta http-equiv=\"refresh\" content=\"30;url='login.php'\">";

} else {
  ?>
  注册失败，请重新<a href="register.php">注册</a>！
  <?php
}   
 ?>
 
 
 <?php
include "../mysql/mysqlclose.php";
?>
</body>
</html>